<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>试题导入</title>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<c:set var="path" value="<%=basePath%>"></c:set>
<link href="${path }/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="${path }/js/bootstrap-select/bootstrap-select.min.css"
	rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="${path }/js/zeroModal/zeroModal.css" />
<style type="text/css">
.wrap select {
	width: 130px;
	height: 30px;
}

.dropdown-toggle {
	height: 30px;
}

#examPaperChoose {
	display: none;
}

.importToNewPaper {
	display: none;
}

.tips {
	color: #205AA7;
}
</style>
</head>
<body>
	<div class="container">
		<div class="row clearfix">
			<div class="col-md-8 column">
				<form class="form-horizontal" role="form" action="dispatcherUpload"
					method="post" enctype="multipart/form-data">
					<div class="form-group">
						课程：<select id="courseid" name="courseid">
							<option value="0">请选择</option>
						</select> 章节：<select id="chapterid" name="chapterid">
							<option value="0">请选择</option>
						</select> 知识点：<select id="pointsid" name="pointsid">
							<option value="0">请选择</option>
						</select>
					</div>
					<div class="form-group">
						<label for="importChoose" class="col-sm-2 control-label">选项</label>
						<div class="col-sm-10">
							<label class="radio-inline"> <input type="radio"
								name="importOption" id="only-subject" value="0"
								checked="checked" /> 只导入试题
							</label> <input class="from-control" style="display: none;" /> <span
								class="help-block" id="alltips">注意: 导入 Excel 文件中的第一行必须是包含
								<b class="tips">题目</b>|<b class="tips">答案A-D</b>|<b class="tips">正确答案</b>|<b
								class="tips">分值</b>|<b class="tips">试题类型</b>|<b class="tips">难易程度</b><b class="tips">试题解析</b>
								与其列对应, 第一行标题名不得有误, 否则将无法解析; 如果是导入到新建试卷, 试卷和试题同用 分科、科目、年级信息。
							</span>
						</div>
					</div>
					<div class="form-group importToNewPaper">
						<label for="examPaperEasy" class="col-sm-2 control-label">难易程度</label>
						<div class="col-sm-10">
							<select class="selectpicker" name="examPaperEasy"
								id="examPaperEasy" data-live-search="true">
								<option value="0">简单</option>
								<option value="1">普通</option>
								<option value="2">困难</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="inputfile" class="col-sm-2 control-label">选择文件</label>
						<div class="col-sm-10">
							<input class="" name="inputfile" id="inputfile" type="file" />
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
							<button type="submit" class="btn btn-default">提交</button>
						</div>
					</div>
				</form>
			</div>
			<div class="col-md-4 column"></div>
		</div>
	</div>

	<!-- js引入 -->
	<script src="${path }/js/jquery.js"></script>
	<script src="${path }/js/bootstrap/bootstrap.min.js"></script>
	<script src="${path }/js/bootstrap-select/bootstrap-select.min.js"></script>
	<script src="${path }/js/zeroModal/zeroModal.min.js"></script>
	<script type="text/javascript">
		$('.selectpicker').selectpicker({
			style : 'btn-default',
			size : 8
		});
		$(function() {
			$("#alltips").css("font-size", "12px");
			$("#only-subject").click(function() {
				$("#examPaperChoose").hide();
				$(".importToNewPaper").hide();
			});
			$("#radio-exists").click(function() {
				$("#examPaperChoose").show("slow");
				$(".importToNewPaper").hide();
			});
			$("#radio-new").click(function() {
				$("#examPaperChoose").hide();
				$(".importToNewPaper").show("slow");
			});
		});
	</script>
	<script type="text/javascript">
		function getchapterdata() {
			$("#chapterid").empty();
			var cid = $("#courseid").val();
			$
					.ajax({
						type : "GET",
						url : "/schoolsystem/getSubjectChapter/" + cid,
						dataType : "json"
					})
					.done(
							function(data) {
								$("#chapterid").append($("<option value='0'>请选择</option>"));
								for ( var i in data) {
									$("#chapterid")
											.append(
													$("<option value='"+ data[i].specialty_id +"'>"
															+ data[i].specialty_name
															+ "</option>"))
								}
								getPointsdata()
							});
		}
		function getPointsdata() {
			$("#pointsid").empty();
			var cid = $("#chapterid").val();
			$
					.ajax({
						url : "/schoolsystem/getSubjectPoints/" + cid,
						dataType : "json"
					})
					.done(
							function(data) {
								$("#pointsid").append($("<option value='0'>请选择</option>"));
								for ( var i in data) {
									$("#pointsid")
											.append(
													$("<option value='"+ data[i].specialty_id +"'>"
															+ data[i].specialty_name
															+ "</option>"))
								}
							})

		}
		$
				.ajax({
					type : "GET",
					url : "/schoolsystem/getSubjectCourse",
					dataType : "json"
				})
				.done(
						function(data) {
							for ( var i in data) {
								$("#courseid")
										.append(
												$("<option value = '"+data[i].specialty_id+"'>"
														+ data[i].specialty_name
														+ "</option>"))
							}
						});
		$("#courseid").change(function() {
			getchapterdata();
		})
		$("#chapterid").change(function() {
			getPointsdata();
		})
	</script>
</body>
</html>